Skip to contentSkip to conversation

Change in openvpn[master]: dns: support multiple domains without DHCP

Openvpn-devel Superseded d12fk (Code Review) 2 participants 37 messages Dec 4, 2024 – Mar 12, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1733316222000.Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/824?usp=email

to review the following change.

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---
M src/openvpn/tun.c
M src/openvpnserv/interactive.c

2 files changed, 708 insertions(+), 110 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/1

src/openvpn/tun.c +35 -12
index 1e67d37..53f3ebc 100644
@@ -183,9 +183,10 @@
 {
     ack_message_t ack;
     struct gc_arena gc = gc_new();
-    HANDLE pipe = tt->options.msg_channel;
+    const struct tuntap_options *o = &tt->options;
 
-    if (!tt->options.domain) /* no  domain to add or delete */
+    /* no domains to add or delete */
+    if (!o->domain && !o->domain_search_list[0])
     {
         goto out;
     }
@@ -203,28 +204,50 @@
         .addr_len = 0       /* add/delete only the domain, not DNS servers */
     };
 
+    /* interface name is required */
     strncpynt(dns.iface.name, tt->actual_name, sizeof(dns.iface.name));
-    strncpynt(dns.domains, tt->options.domain, sizeof(dns.domains));
-    /* truncation of domain name is not checked as it can't happen
-     * with 512 bytes room in dns.domains.
-     */
+    dns.iface.name[sizeof(dns.iface.name) - 1] = '\0';
 
-    msg(D_LOW, "%s dns domain on '%s' (if_index = %d) using service",
+    /* only use domain when there are no search domains */
+    if (o->domain && !o->domain_search_list[0])
+    {
+        strncpynt(dns.domains, o->domain, sizeof(dns.domains));
+    }
+
+    /* Create a comma separated list of search domains */
+    for (int i = 0; i < N_SEARCH_LIST_LEN && o->domain_search_list[i]; ++i)
+    {
+        size_t dstlen = strlen(dns.domains);
+        size_t srclen = strlen(o->domain_search_list[i]);
+        size_t extra = dstlen ? 2 : 1; /* space for comma and NUL */
+        if (dstlen + srclen + extra > sizeof(dns.domains))
+        {
+            msg(M_WARN, "DNS search domains sent to service truncated to %d", i);
+            break;
+        }
+        if (dstlen)
+        {
+            dns.domains[dstlen++] = ',';
+        }
+        strncpynt(dns.domains + dstlen, o->domain_search_list[i], srclen);
+    }
+
+    msg(D_LOW, "%s DNS domains on '%s' (if_index = %d) using service",
         (add ? "Setting" : "Deleting"), dns.iface.name, dns.iface.index);
-    if (!send_msg_iservice(pipe, &dns, sizeof(dns), &ack, "TUN"))
+    if (!send_msg_iservice(o->msg_channel, &dns, sizeof(dns), &ack, "TUN"))
     {
         goto out;
     }
 
     if (ack.error_number != NO_ERROR)
     {
-        msg(M_WARN, "TUN: %s dns domain failed using service: %s [status=%u if_name=%s]",
+        msg(M_WARN, "TUN: %s DNS domains failed using service: %s [status=%u if_name=%s]",
             (add ? "adding" : "deleting"), strerror_win32(ack.error_number, &gc),
             ack.error_number, dns.iface.name);
         goto out;
     }
 
-    msg(M_INFO, "DNS domain %s using service", (add ? "set" : "deleted"));
+    msg(M_INFO, "DNS domains %s using service", (add ? "set" : "deleted"));
 
 out:
     gc_free(&gc);
@@ -1719,7 +1742,7 @@
     argv_free(&argv);
     gc_free(&gc);
 #endif /* if defined(TARGET_LINUX) */
-       /* Empty for _WIN32 and all other unixoid platforms */
+    /* Empty for _WIN32 and all other unixoid platforms */
 }
 
 static void
@@ -1745,7 +1768,7 @@
     argv_free(&argv);
     gc_free(&gc);
 #endif /* if defined(TARGET_LINUX) */
-       /* Empty for _WIN32 and all other unixoid platforms */
+    /* Empty for _WIN32 and all other unixoid platforms */
 }
 
 void
src/openvpnserv/interactive.c +673 -98

857 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/824?usp=email

to look at the new patch set (#2).

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---
M src/openvpn/tun.c
M src/openvpnserv/interactive.c

2 files changed, 708 insertions(+), 110 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/2

src/openvpn/tun.c +35 -12
index 1e67d37..53f3ebc 100644
@@ -183,9 +183,10 @@
 {
     ack_message_t ack;
     struct gc_arena gc = gc_new();
-    HANDLE pipe = tt->options.msg_channel;
+    const struct tuntap_options *o = &tt->options;
 
-    if (!tt->options.domain) /* no  domain to add or delete */
+    /* no domains to add or delete */
+    if (!o->domain && !o->domain_search_list[0])
     {
         goto out;
     }
@@ -203,28 +204,50 @@
         .addr_len = 0       /* add/delete only the domain, not DNS servers */
     };
 
+    /* interface name is required */
     strncpynt(dns.iface.name, tt->actual_name, sizeof(dns.iface.name));
-    strncpynt(dns.domains, tt->options.domain, sizeof(dns.domains));
-    /* truncation of domain name is not checked as it can't happen
-     * with 512 bytes room in dns.domains.
-     */
+    dns.iface.name[sizeof(dns.iface.name) - 1] = '\0';
 
-    msg(D_LOW, "%s dns domain on '%s' (if_index = %d) using service",
+    /* only use domain when there are no search domains */
+    if (o->domain && !o->domain_search_list[0])
+    {
+        strncpynt(dns.domains, o->domain, sizeof(dns.domains));
+    }
+
+    /* Create a comma separated list of search domains */
+    for (int i = 0; i < N_SEARCH_LIST_LEN && o->domain_search_list[i]; ++i)
+    {
+        size_t dstlen = strlen(dns.domains);
+        size_t srclen = strlen(o->domain_search_list[i]);
+        size_t extra = dstlen ? 2 : 1; /* space for comma and NUL */
+        if (dstlen + srclen + extra > sizeof(dns.domains))
+        {
+            msg(M_WARN, "DNS search domains sent to service truncated to %d", i);
+            break;
+        }
+        if (dstlen)
+        {
+            dns.domains[dstlen++] = ',';
+        }
+        strncpynt(dns.domains + dstlen, o->domain_search_list[i], srclen);
+    }
+
+    msg(D_LOW, "%s DNS domains on '%s' (if_index = %d) using service",
         (add ? "Setting" : "Deleting"), dns.iface.name, dns.iface.index);
-    if (!send_msg_iservice(pipe, &dns, sizeof(dns), &ack, "TUN"))
+    if (!send_msg_iservice(o->msg_channel, &dns, sizeof(dns), &ack, "TUN"))
     {
         goto out;
     }
 
     if (ack.error_number != NO_ERROR)
     {
-        msg(M_WARN, "TUN: %s dns domain failed using service: %s [status=%u if_name=%s]",
+        msg(M_WARN, "TUN: %s DNS domains failed using service: %s [status=%u if_name=%s]",
             (add ? "adding" : "deleting"), strerror_win32(ack.error_number, &gc),
             ack.error_number, dns.iface.name);
         goto out;
     }
 
-    msg(M_INFO, "DNS domain %s using service", (add ? "set" : "deleted"));
+    msg(M_INFO, "DNS domains %s using service", (add ? "set" : "deleted"));
 
 out:
     gc_free(&gc);
@@ -1719,7 +1742,7 @@
     argv_free(&argv);
     gc_free(&gc);
 #endif /* if defined(TARGET_LINUX) */
-       /* Empty for _WIN32 and all other unixoid platforms */
+    /* Empty for _WIN32 and all other unixoid platforms */
 }
 
 static void
@@ -1745,7 +1768,7 @@
     argv_free(&argv);
     gc_free(&gc);
 #endif /* if defined(TARGET_LINUX) */
-       /* Empty for _WIN32 and all other unixoid platforms */
+    /* Empty for _WIN32 and all other unixoid platforms */
 }
 
 void
src/openvpnserv/interactive.c +673 -98

857 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 2:

(3 comments)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/21f75f54_201cbbb0 :
PS2, Line 1302: CloseServiceHandle(dnssvc);
SAL:

Warning C6387 'dnssvc' could be '0'. openvpn C:\Users\lev\Projects\openvpn-build\src\openvpn\src\openvpnserv\interactive.c 1302

same on the following line. Add a NULL check?

http://gerrit.openvpn.net/c/openvpn/+/824/comment/d64294ff_24966968 :
PS2, Line 1584: size = (wcslen(list) + 1) * sizeof(list[0]);
I got a SAL warning:

Warning C6053 The prior call to 'wcsncpy' might not zero-terminate string 'list'. openvpn C:\Users\lev\Projects\openvpn-build\src\openvpn\src\openvpnserv\interactive.c 1584

I think on line 1581 we have +1 to copy NULL terminator from domains, so this is not an issue? Should we also initialize list with {0} to make SAL happy?

http://gerrit.openvpn.net/c/openvpn/+/824/comment/e58e3f80_84b5ad3c :
PS2, Line 1648: RemoveDnsSearchDomains(HKEY key, PCWSTR domains) SAL warning:

Warning C6262 Function uses '16432' bytes of stack. Consider moving some data to heap. openvpn C:\Users\lev\Projects\openvpn-build\src\openvpn\src\openvpnserv\interactive.c 1648

Is 4096 a random "large enough" value? Can we make it, say, 2048 to make SAL happy?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Mon, 09 Dec 2024 12:28:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 2:

(1 comment)

Patchset:

PS2:
"Now this works as well in netsh mode with the interactive service."

By "netsh mode" you mean "--ip-win32 netsh" which is set for DCO? I would probably write "for non-DHCP drivers", or just "ovpn-dco". I think --ip-win32 is a bit obscure option.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Mon, 09 Dec 2024 12:44:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/824?usp=email

to look at the new patch set (#3).

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---
M src/openvpn/options.c
M src/openvpn/tun.c
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/Makefile.am
M src/openvpnserv/interactive.c

5 files changed, 720 insertions(+), 113 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/3

src/openvpn/options.c +1 -1
index d8dd518..fa22eca 100644
@@ -8231,7 +8231,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +35 -12

86 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index 154e17c..ccde43a 100644
@@ -27,7 +27,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +679 -98

863 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 3:

(3 comments)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/df2d8e6a_fc1974ba :
PS2, Line 1302: CloseServiceHandle(dnssvc);

Quoted 1 line

SAL: […]

Done

http://gerrit.openvpn.net/c/openvpn/+/824/comment/848dd16c_3cd12015 :
PS2, Line 1584: size = (wcslen(list) + 1) * sizeof(list[0]);

Quoted 1 line

I got a SAL warning: […]

The actual check is in line 1572 where we make sure there is enough room in the buffer to append the domains including the NUL at the end (+2, one for the comma, the other one for \0)

wcsncpy() pads the source string wit 0 if count is greater than the len of the source string, so domlen + 1 will do the trick.

I think it is indeed a false positive and wonder what triggers it. Let's try to init list with zeros and if that defeats the diagnostic, good enough, but it is not necessary.

http://gerrit.openvpn.net/c/openvpn/+/824/comment/ffa63cf0_730a2c02 :
PS2, Line 1648: RemoveDnsSearchDomains(HKEY key, PCWSTR domains)

Quoted 1 line

SAL warning: […]

Yeah, let's go with 2k and see where we land. Usually this should not be an issue I think as there are normally not so many search domains set. There _is_ no correct value here, unless you re(allocate) from the heap to make sure the local maximum is handled.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 12 Dec 2024 07:51:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos, stipa.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 3: Code-Review-1

(4 comments)

Patchset:

PS3:
Please fix uncrustify error

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/b621b398_0802bd0d :
PS3, Line 1745: /* Empty for _WIN32 and all other unixoid platforms */
Spurious change that cause uncrustify errors

http://gerrit.openvpn.net/c/openvpn/+/824/comment/efa0cc81_d7b34f57 :
PS3, Line 1771: /* Empty for _WIN32 and all other unixoid platforms */
Spurious change that causes uncrustify errors

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/0d1c989c_d836d102 :
PS3, Line 1333: MsgToEventLog(M_ERR, L"InterfaceIdString: "
Why L"" here and not TEXT()?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: stipa <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Fri, 13 Dec 2024 16:33:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#8 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 3: Code-Review-1

(2 comments)

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/0f9f3597_7d564171 :
PS3, Line 232: strncpynt(dns.domains + dstlen, o->domain_search_list[i], srclen);
Hm, this doesn't appear to work.

PUSH: Received control message: 'PUSH_REPLY,dns search-domains lol1 lol2,

In this case srclen is 4, but strncpynt copies first 3 chars and then adds \0. Shall we use just strncpy?

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/2b842d94_2e39b8fd :
PS3, Line 2302: break;
extra "break"

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Tue, 17 Dec 2024 10:10:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#9 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos, stipa.

Hello flichtenheld, plaisthos, stipa,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/824?usp=email

to look at the new patch set (#4).

The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld, Code-Review-1 by stipa

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---
M src/openvpn/options.c
M src/openvpn/tun.c
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/Makefile.am
M src/openvpnserv/interactive.c

5 files changed, 716 insertions(+), 111 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/4

src/openvpn/options.c +1 -1
index b2a3a8b..cc723ca 100644
@@ -8231,7 +8231,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +33 -10

70 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index 154e17c..ccde43a 100644
@@ -27,7 +27,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +677 -98

861 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 4
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#10 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 4:

(5 comments)

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/44d589a3_55773eae :
PS3, Line 232: strncpynt(dns.domains + dstlen, o->domain_search_list[i], srclen);

Quoted 1 line

Hm, this doesn't appear to work. […]

Yeah, in this case it's better since remaining buffer is checked before to fit the terminating zero. strcpy would work as well, but usually raises an eyebrow with tools. So, adding the missing srclen + 1 for strncpy for the actual fix.

http://gerrit.openvpn.net/c/openvpn/+/824/comment/d469bffe_01c87c06 :
PS3, Line 1745: /* Empty for _WIN32 and all other unixoid platforms */

Quoted 1 line

Spurious change that cause uncrustify errors

Acknowledged

http://gerrit.openvpn.net/c/openvpn/+/824/comment/64d0080e_818b319f :
PS3, Line 1771: /* Empty for _WIN32 and all other unixoid platforms */

Quoted 1 line

Spurious change that causes uncrustify errors

Acknowledged

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/7cee0941_deaae7b2 :
PS3, Line 1333: MsgToEventLog(M_ERR, L"InterfaceIdString: "

Quoted 1 line

Why L"" here and not TEXT()?

TEXT() expands to L"" when UNICODE is defined, but will change for consistency anyway. There's another one at #766, but unrelated to this changeset. Will try to remember to ship a followup patch for this later.

http://gerrit.openvpn.net/c/openvpn/+/824/comment/da696840_4fc75d6d :
PS3, Line 2302: break;

Quoted 1 line

extra "break"

Acknowledged

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 4
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Sat, 21 Dec 2024 22:40:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#11 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos, stipa.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 5:

(1 comment)

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/44146ab4_84c71d5b :
PS5, Line 209: dns.iface.name[sizeof(dns.iface.name) - 1] = '\0';
strncpynt already takes care of this.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Dec 2024 12:02:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#12 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 5:

(1 comment)

Patchset:

PS5:
Is domain-specific SearchList supposed to be cleared on disconnect? It does not, and when we connect next time without server pushing search domains, old values are still there.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 5
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Dec 2024 15:23:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#13 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos.

Hello flichtenheld, plaisthos, stipa,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/824?usp=email

to look at the new patch set (#6).

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---
M src/openvpn/options.c
M src/openvpn/tun.c
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/Makefile.am
M src/openvpnserv/interactive.c

5 files changed, 719 insertions(+), 111 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/6

src/openvpn/options.c +1 -1
index b2a3a8b..cc723ca 100644
@@ -8231,7 +8231,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +33 -10

70 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index 154e17c..ccde43a 100644
@@ -27,7 +27,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +680 -98

864 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 6
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-MessageType: newpatchset

#14 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 6:

(1 comment)

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/88e1e941_249de986 :
PS5, Line 209: dns.iface.name[sizeof(dns.iface.name) - 1] = '\0';

Quoted 1 line

strncpynt already takes care of this.

Acknowledged

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 6
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 23 Dec 2024 16:38:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#15 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos, stipa,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/824?usp=email

to look at the new patch set (#7).

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---
M src/openvpn/options.c
M src/openvpn/tun.c
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/Makefile.am
M src/openvpnserv/interactive.c

5 files changed, 718 insertions(+), 111 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/7

src/openvpn/options.c +1 -1
index b2a3a8b..cc723ca 100644
@@ -8231,7 +8231,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +32 -10

69 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index 154e17c..ccde43a 100644
@@ -27,7 +27,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +680 -98

864 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 7
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#16 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 7:

(1 comment)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/d44ab783_f4f83bba :
PS7, Line 1390: if (strchr(data, '.') != NULL)
Are you sure about the dot? For instance, "xxx" appears to be a perfectly valid value for Windows. In this case (SearchList here HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters is set to "xxx") this takes precedence over adapter-specific search list. This means that VPN pushed search domains do not work, because we assume that global search list is not valid and add search domains to adapter.

Moreover, is something like ".xxx" even valid? With SearchList like "xxx,aaa,bbb" and "ping test" I see outgoing DNS requests to test.xxx, test.aaa and test.bbb. With ".xxx,.aaa,.bbb" no DNS requests are sent.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 7
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Thu, 26 Dec 2024 12:54:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#17 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 7:

(1 comment)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/264e0111_0a8024ee :
PS7, Line 1390: if (strchr(data, '.') != NULL)

Quoted 1 line

Are you sure about the dot? For instance, "xxx" appears to be a perfectly valid value for Windows. […]

While you can enter pretty much any text as SearchList, the resolver parses the values quite tightly. My tests have shown that invalid domain suffixes are ignored and not added to the runtime config. So, I think while ckecking for a dot in the string does not catch all misconfigurations it serves well to determine if we should try at a certain location at least.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 7
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 30 Dec 2024 23:51:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#18 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 7: Code-Review-1

(1 comment)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/4d921f1e_b329741b :
PS7, Line 1390: if (strchr(data, '.') != NULL)

Quoted 1 line

While you can enter pretty much any text as SearchList, the resolver parses the values quite tightly […]

I used powershell command to edit search list, for example:

Set-DnsClientGlobalSetting -SuffixSearchList bbbb

Besides, MSFT documentation provides examples without dot prefix:

https://learn.microsoft.com/en-us/troubleshoot/windows-client/networking/configure-domain-suffix-search-list-domain-name-system-clients

So in my tests dot prefix appears invalid and documentation concurs with it.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 7
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Tue, 31 Dec 2024 10:16:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: d12fk <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#19 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 7:

(1 comment)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/e5fcf618_a2f7fb08 :
PS7, Line 1390: if (strchr(data, '.') != NULL)

Quoted 1 line

I used powershell command to edit search list, for example: […]

Yeah, as I said, you can enter anything, but it will not be used unless it is a valid second level fqdn, which has an embedded dot, e.g. 'openvpn.net' will be used, just 'net' will not be used.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 7
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Tue, 31 Dec 2024 17:41:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: d12fk <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#20 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 7:

(1 comment)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/fb7b9b98_a376dd6a :
PS7, Line 1390: if (strchr(data, '.') != NULL)

Quoted 1 line

Yeah, as I said, you can enter anything, but it will not be used unless it is a valid second level f […]

I used powershell command to add TLD, not editing registry directly, and this worked. I haven't seen anywhere saying that TLD is forbidden as search domains, but I have seen those been used in practice. So I don't really understand why we need to have this restriction and a code for it, instead of just checking if SearchList is empty or not.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 7
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Thu, 02 Jan 2025 09:31:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: d12fk <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#21 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 7:

(1 comment)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/a52622c1_17301bfa :
PS7, Line 1390: if (strchr(data, '.') != NULL)

Quoted 1 line

I used powershell command to add TLD, not editing registry directly, and this worked. […]

An empty list will not be used by the resolver, even if it it contains only whitespace characters. So checking for strlen doesn't work here. So, the idea was to check for a '.' to make sure the list _is_ actually used, so we add instead of "create". I think this way the detection is sufficiently working.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 7
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 13 Jan 2025 08:46:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: d12fk <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#22 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 7:

(1 comment)

Patchset:

PS7:
A "." is not mandatory in a search domain (as Lev tested), and if our aim is "is this only whitespace or something else?" maybe we should check for "is this only whitespace" instead.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 7
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 13 Jan 2025 08:53:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#23 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos, stipa.

Hello flichtenheld, plaisthos, stipa,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/824?usp=email

to look at the new patch set (#8).

The following approvals got outdated and were removed:
Code-Review-1 by stipa

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---
M src/openvpn/options.c
M src/openvpn/tun.c
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/Makefile.am
M src/openvpnserv/interactive.c

5 files changed, 721 insertions(+), 111 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/8

src/openvpn/options.c +1 -1
index eb0d9b5..8a6d3b6 100644
@@ -8198,7 +8198,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +32 -10

69 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index 154e17c..ccde43a 100644
@@ -27,7 +27,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +683 -98

867 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 8
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#24 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 8:

(1 comment)

Patchset:

PS8:
Looks good and does what it says. I tested that pushed search domains are indeed applied and Windows uses them for DNS lookup and than existing search domains are preserved and restored after disconnect.

However this warning is still triggered for search-domains:

Mon Jan 20 13:52:28 2025 Some --dhcp-option or --dns options require DHCP server, which is not supported by the selected ovpn-dco driver. They will be ignored.

Let's get rid of it buy not setting the flag in tuntap_options_copy_dns(),

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 8
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Mon, 20 Jan 2025 11:54:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#25 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 10:

(1 comment)

Patchset:

PS10:
Looks good, but DHCP warning is still there.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 10
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Wed, 05 Mar 2025 11:35:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#26 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 11:

(1 comment)

Patchset:

PS10:

Quoted 1 line

Looks good, but DHCP warning is still there.

The warning is gone after #240, where the code copying --dns values is removed

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 11
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 06 Mar 2025 13:11:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#27 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 11:

(1 comment)

Patchset:

PS10:

Quoted 1 line

The warning is gone after #240, where the code copying --dns values is removed

sorry #840 ;-)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 11
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 06 Mar 2025 13:12:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: d12fk <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment

#28 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 12: Code-Review+2

(1 comment)

Patchset:

PS12:
Agreed that warning will be removed later. Apart from that, code looks good and does what it says.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 12
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Sun, 09 Mar 2025 11:15:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#29 lore raw

PATCH v12 1/1 dns: support multiple domains without DHCP

In reply to a message not in the archive

From: Heiko Hund <[email protected]...>

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/824
This mail reflects revision 12 of this Change.

Acked-by according to Gerrit (reflected above):
Lev Stipakov <[email protected]...>

src/openvpn/options.c +1 -1
index 511ce05..11a19bb 100644
@@ -8352,7 +8352,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +32 -10

69 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index ff03867..44a40fe 100644
@@ -28,7 +28,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +683 -98

867 lines not on this page · raw message

#30 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 12: Code-Review-1

(8 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/0e9bde67_521ea38a :
PS12, Line 23:
please reference the github issue about WMIC no longer working on Win11

Github: OpenVPN/openvpn#642

Patchset:

PS12:
a couple of very minor nits, but there's one thing I consider important enough to clarify before applying.

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/614ca4f1_082ef8e0 :
PS12, Line 1171: ApplyGpolSettings32()
(void)

http://gerrit.openvpn.net/c/openvpn/+/824/comment/15f3c9b6_c46bf981 :
PS12, Line 1211: ApplyGpolSettings64()
(void)

http://gerrit.openvpn.net/c/openvpn/+/824/comment/31278e47_77ce57be :
PS12, Line 1248: ApplyGpolSettings()
(void)

http://gerrit.openvpn.net/c/openvpn/+/824/comment/17e52f07_1dd206a9 :
PS12, Line 1609: * If it doesn't exists, resets to empty, effectively disabling it. typo here ("exists")

http://gerrit.openvpn.net/c/openvpn/+/824/comment/94c13555_6c14a07a :
PS12, Line 1631: goto out;
my understanding of the code flow is that the goto out should be inside the if (err != ERROR_FILE_NOT_FOUND) because otherwise the described behaviour "if it doesn't exist = FILE NOT FOUND, reset to empty" can never be triggered.

http://gerrit.openvpn.net/c/openvpn/+/824/comment/c8ba0a57_5dfb1b78 :
PS12, Line 1698: }
in this case ("no InitialSearchList can be found") this whole function would then fail to do anything, as RegSetValueExW() is skipped. Is this intentional?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 12
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Sun, 09 Mar 2025 15:21:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#31 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

d12fk has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 12:

(7 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/7e7bfac6_b367e51d :
PS12, Line 23:

Quoted 1 line

please reference the github issue about WMIC no longer working on Win11 […]

Done

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/70916549_d4e0161f :
PS12, Line 1171: ApplyGpolSettings32()

Quoted 1 line

(void)

Done

http://gerrit.openvpn.net/c/openvpn/+/824/comment/2b36d095_cbfd9faa :
PS12, Line 1211: ApplyGpolSettings64()

Quoted 1 line

(void)

Done

http://gerrit.openvpn.net/c/openvpn/+/824/comment/12b0644b_5e2f5cad :
PS12, Line 1248: ApplyGpolSettings()

Quoted 1 line

(void)

Done

http://gerrit.openvpn.net/c/openvpn/+/824/comment/2dd35100_49932acc :
PS12, Line 1609: * If it doesn't exists, resets to empty, effectively disabling it.

Quoted 1 line

typo here ("exists")

Done

http://gerrit.openvpn.net/c/openvpn/+/824/comment/ea2a7802_1d8a8a94 :
PS12, Line 1631: goto out;

Quoted 1 line

my understanding of the code flow is that the goto out should be inside the `if (err != ERROR_FILE […]

Yeah that is intentional. If there was no SearchList, there will be no IninitalSearchList created in the first place.

http://gerrit.openvpn.net/c/openvpn/+/824/comment/6b364f9b_c7efb34c :
PS12, Line 1698: }

Quoted 1 line

in this case ("no InitialSearchList can be found") this whole function would then fail to do anythin […]

When we get there something is inconsistent in the registry. The SearchList is not empty, but we do not have a InitialSearchList to compare to. Storing the shorter, but non-empty list is as wrong as leaving it in its current state, as it is not empty, not can it be reset to the original list.

If you rather have the return removed and the next branch turned into an else if I can do it, but the SearchList will still be in an undefined state after the modification.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 12
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 12 Mar 2025 04:05:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#32 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.

Hello cron2, flichtenheld, plaisthos, stipa,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/824?usp=email

to look at the new patch set (#13).

The following approvals got outdated and were removed:
Code-Review+2 by stipa, Code-Review-1 by cron2

The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Github: closes OpenVPN/openvpn#642

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---
M src/openvpn/options.c
M src/openvpn/tun.c
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/Makefile.am
M src/openvpnserv/interactive.c

5 files changed, 722 insertions(+), 111 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/13

src/openvpn/options.c +1 -1
index 704e65a..31000e9 100644
@@ -8370,7 +8370,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +32 -10

69 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index ff03867..44a40fe 100644
@@ -28,7 +28,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +684 -98

868 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 13
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset

#33 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, flichtenheld, plaisthos, stipa.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

Patch Set 13: Code-Review+2

(3 comments)

Patchset:

PS13:
There's still a partly unresolved discussion and it needs to be tested what happens with multiple concurrent VPNs modifying the global search list - but for all normal cases this should work fine. I'm moving forward, and we can fix this particular corner case later if it turns out to be problematic.

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/824/comment/3d28cfaf_6da650d8 :
PS12, Line 1631: goto out;

Quoted 1 line

Yeah that is intentional. […]

With the adjusted comment ("doesn't reset anything") the code now matches the comment, so fine with me :-)

http://gerrit.openvpn.net/c/openvpn/+/824/comment/3e617702_23668b59 :
PS12, Line 1698: }

Quoted 1 line

When we get there something is inconsistent in the registry. […]

Indeed, we should never end in this state at all - though I do wonder what happens if there are overlapping VPNs modifying the global search list (both adding to it, and then the first existing and resetting the InitialSearchList). Guess we'll find out when the first issue gets openened :-)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 13
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Wed, 12 Mar 2025 09:21:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: d12fk <[email protected]...>
Gerrit-MessageType: comment

#34 lore raw

PATCH v13 1/1 dns: support multiple domains without DHCP

In reply to a message not in the archive

From: Heiko Hund <[email protected]...>

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Github: closes OpenVPN/openvpn#642

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/824
This mail reflects revision 13 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/options.c +1 -1
index 704e65a..31000e9 100644
@@ -8370,7 +8370,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +32 -10

69 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index ff03867..44a40fe 100644
@@ -28,7 +28,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +684 -98

868 lines not on this page · raw message

#35 lore raw

[Openvpn-devel] [PATCH applied] Re: dns: support multiple domains without DHCP

I have stared at the code for quite a while and it should do what it intends to do. Lev has tested it and +2'ed based on the test results.

There is one thing we need to re-test (will it behave properly if two concurrent VPN sessions modify the global search list), but the standard case is a "per interface" searchlist, so this is rare enough to not hold up the DNS patch series further (*if* there is an issue lurking, it will be "not properly cleaned up", but no "crash or anything").

Test compiled on Ubuntu 2204/MinGW64, no (new) warnings.

Your patch has been applied to the master branch.

commit ae90cbad50641cdf2579d1a6bcc35144866f68b1

Author: Heiko Hund
Date:   Wed Mar 12 10:22:53 2025 +0100
     dns: support multiple domains without DHCP

     Signed-off-by: Heiko Hund <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg31108.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#36 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#14) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Github: closes OpenVPN/openvpn#642

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31108.html

---
M src/openvpn/options.c
M src/openvpn/tun.c
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/Makefile.am
M src/openvpnserv/interactive.c

5 files changed, 722 insertions(+), 111 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/24/824/14

src/openvpn/options.c +1 -1
index 704e65a..31000e9 100644
@@ -8370,7 +8370,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +32 -10

69 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index ff03867..44a40fe 100644
@@ -28,7 +28,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +684 -98

868 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 14
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#37 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/824?usp=email )

Change subject: dns: support multiple domains without DHCP
......................................................................

dns: support multiple domains without DHCP

Instead of using wmic on Windows to set one (the first) DNS domain, modify the registry directly and let the resolver know that something changed.

This fixes that more than one search domain suffix could only be applied when DHCP and the tap driver was used. Now this works as well in netsh mode with the interactive service.

If possible the search domains are stored with the rest of the VPN interface parameter values. However, a global search list and one which is distributed via group policy have priority (in that order), so we probe for the existence of those first. In order to be able to restore the original list in any case we store an "initial list" as a backup of the search list before we modify it.

Github: closes OpenVPN/openvpn#642

Change-Id Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31108.html

---
M src/openvpn/options.c
M src/openvpn/tun.c
M src/openvpnserv/CMakeLists.txt
M src/openvpnserv/Makefile.am
M src/openvpnserv/interactive.c

5 files changed, 722 insertions(+), 111 deletions(-)
src/openvpn/options.c +1 -1
index 704e65a..31000e9 100644
@@ -8370,7 +8370,7 @@
                 msg(msglevel, "--dhcp-option %s: maximum of %d search entries can be specified",
                     p[1], N_SEARCH_LIST_LEN);
             }
-            o->dhcp_options |= DHCP_OPTIONS_DHCP_REQUIRED;
+            o->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
         }
         else if (streq(p[1], "DISABLE-NBT") && !p[2])
         {
src/openvpn/tun.c +32 -10

69 lines not on this page · raw message

src/openvpnserv/CMakeLists.txt +2 -1
index ff03867..44a40fe 100644
@@ -28,7 +28,8 @@
     -D_WIN32_WINNT=_WIN32_WINNT_VISTA
     )
 target_link_libraries(openvpnserv
-    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib)
+    advapi32.lib userenv.lib iphlpapi.lib fwpuclnt.lib rpcrt4.lib
+    shlwapi.lib netapi32.lib ws2_32.lib ntdll.lib ole32.lib)
 if (MINGW)
     target_compile_options(openvpnserv PRIVATE -municode)
     target_link_options(openvpnserv PRIVATE -municode)
src/openvpnserv/Makefile.am +3 -1
index 621ce73..f053f40 100644
@@ -25,7 +25,9 @@
 	-municode -D_UNICODE \
 	-UNTDDI_VERSION -U_WIN32_WINNT \
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
-openvpnserv_LDADD = -ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 -lshlwapi -lnetapi32 -lws2_32 -lntdll
+openvpnserv_LDADD = \
+	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
 endif
 
 openvpnserv_SOURCES = \
src/openvpnserv/interactive.c +684 -98

868 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/824?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icaffbfa6b2e8efa2bd24a05537cb74b15f4fed96
Gerrit-Change-Number: 824
Gerrit-PatchSet: 14
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged